package socketTest;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class NetGetKeepAlive {
	public static final short TIME_PORT = 135;
	
	public static void main(String[] args) throws IOException{
		String hostName = null;
		System.out.println();
		
		try{
			Socket socket = new Socket(hostName, TIME_PORT);
			System.out.println("socket =" + socket);
			System.out.println("Keep Alive =" + socket.getKeepAlive());
			System.out.println("Send Buffer size =" + socket.getSendBufferSize());
			System.out.println("output =" + socket.isOutputShutdown());
			System.out.println("port is =" + socket.getPort());
			System.out.println("socket address =" + socket.getLocalSocketAddress());
			InetAddress in = socket.getInetAddress();
			System.out.println(in);
			System.out.println("\n");
			System.out.println("RAW IP Address - (byte[]) : ");
			byte[] b1 = in.getAddress();
			
			for(int i=0; i<b1.length; i++){
				if(i>0){
					System.out.print(".");}
				System.out.println(b1[i]);
			}
		}catch(UnknownHostException e){
			e.printStackTrace();
		}catch (IOException e) {
			e.printStackTrace();
		}
	}
}
